<include file="Public/head"/>

<body class="no-skin">
<include file="Public/header"/>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>
            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <!-- <a class="btn btn-info" href="{:U('append')}" value="">新增</a> -->
                     <div class="cf">
                            <form class="form-inline" action="" method="get">
                                <a class="btn btn-info" href="{:U('append')}" value="">新增</a>
                                <label class="inline">车牌号</label>
                                <input type="text" name="car_num" value="{:I('car_num')}" class="form-control" id="car_num">
                                <label class="inline">驾照类型</label>
                                    <select name="l_type" id="l_type" class="form-control">
                                        <option value="0">--请选择驾照类型--</option>
                                            <volist name="license_type" id="val">
                                                <option value="{$val['id']}" <if condition="$val['id'] eq I('get.l_type')">selected="selected"</if>>{$val['type']}</option>
                                            </volist>
                                    </select>
                                <button type="button" onclick="sou()" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    搜索
                                </button>
                            </form>
                        </div>
                    <div class="space-4"></div>
                      <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th>驾校名称</th>
                                <th>汽车型号</th>
                                <th>车牌号</th>
                                <th>驾照类型</th>
                                <th>状态</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>

                            <?php if($car){
                                foreach($car as $val){ ?>                            
                                 <tr>
                                    <td><?php echo $val['sc_name']?></td>
                                    <td><?php echo $val['car_type']?></td>
                                    <td><?php echo $val['car_num']?></td>
                                    <td><?php echo $val['type']?></td>
                                    <td> <?php 
                                            if($val['status'] == 0) echo '未分配'; 
                                            if($val['status'] == 1) echo '已分配'; 
                                            if($val['status'] == 2) echo '已弃用'; 
                                            if($val['status'] == 3) echo '损坏'; 
                                         ?>
                                     </td>
                                    <td><a href="<?php echo U('edit',array('id'=>$val['id']));?>"><i
                                            class="ace-icon fa fa-pencil bigger-100"></i>编辑</a>&nbsp;&nbsp;
                                        <a href="javascript:;" val="<?php echo U('del',array('id'=>$val['id']));?>" class="del"><i
                                                class="ace-icon fa fa-trash-o bigger-100 red"></i>删除</a></td>
                                </tr>
                            </foreach>
                            <?php }}else{echo "<tr align='center'><td colspan='9'>暂未添加车辆信息，请添加车辆！</td></tr>";}?> 
                            </tbody>
                        </table>
                    {$page}
                    <!-- PAGE CONTENT ENDS -->
                </div><!-- /.col -->
            </div><!-- /.row -->
        </div><!-- /.page-content -->
    </div>
</div><!-- /.main-content -->
<include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "确定要删除该车辆信息吗?",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });

    function sou(){
        var car_num = $('#car_num').val();
        var l_type = $('#l_type').val();
        var param = '';
        if(car_num){
            param += '/car_num/'+car_num; 
        }
        if(l_type){
            param += '/l_type/'+l_type;
        }

        location.href="__APP__/Admin/Car/index"+param+".html";
    }
</script>
</body>
</html>
